import request from '@/utils/request'

// 创建产品类别
export function addObj(data) {
  return request({
    url: '/product/productCategory/create',
    method: 'post',
    data: data
  })
}

// 更新产品类别
export function putObj(data) {
  return request({
    url: '/product/productCategory/update',
    method: 'put',
    data: data
  })
}

// 删除产品类别
export function delObj(id) {
  return request({
    url: '/product/productCategory/delete?id=' + id,
    method: 'delete'
  })
}

// 获得产品类别
export function getCategory(id) {
  return request({
    url: '/product/productCategory/get?id=' + id,
    method: 'get'
  })
}

// 获得产品类别分页
export function getPage(query) {
  return request({
    url: '/product/productCategory/page',
    method: 'get',
    params: query
  })
}

// 导出产品类别 Excel
export function exportCategoryExcel(query) {
  return request({
    url: '/product/productCategory/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

export function fetchTree(query) {
  return request({
    url: '/product/productCategory/categoryTree',
    method: 'get',
    params: query
  })
}

export function updateStatus(query) {
  return request({
    url: '/product/productCategory/updateStatus',
    method: 'put',
    params: query
  })
}
